﻿// /*------------------------------------------------------------
// 工程名:    Ensemble
// 文件名:    AssemblyResolveEventArgs.cs
// 编写人:    yhh
// 编写日期: 下午 5:10
// -------------------------------------------------------------*/

using System;
using System.Reflection;

namespace Ensemble
{
    public class AssemblyResolveEventArgs : EventArgs
    {
        private Assembly resolvedAssembly;
        private string fullAssemblyName { get; set; }
        private string assemblyName { get; set; }
        public bool IsResolved {
            get { return resolvedAssembly != null; }
        }

        public Assembly ResolvedAssembly {
            get { return resolvedAssembly; }
        }

        public string AssemblyName {
            get { return assemblyName; }
        }

        public AssemblyResolveEventArgs(string fullAssemblyName)
        {
            this.fullAssemblyName = fullAssemblyName;
            this.assemblyName = ReflectionHelper.GetShortAssemblyName(fullAssemblyName);
        }

        public void Resolve(Assembly assembly)
        {
            resolvedAssembly = assembly ?? resolvedAssembly;
        }
    }
}